package com.main.taxsystem;

import java.util.ArrayList;
import java.util.HashMap;

import android.app.ListActivity;
import android.app.SearchManager;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.Toast;

public class SearchableActivity extends ListActivity {
	private static final String TAG ="SearchableActivity";
	private ListView listView = null;
	private SimpleAdapter adapter = null;
	private ArrayList<HashMap<String,String>> list = null;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_searchable);
		
		listView = (ListView)this.findViewById(android.R.id.list);
		adapter = new SimpleAdapter(this,list,R.layout.branch_map_list_item,
				new String[]{"title"},new int[]{R.id.textView1});
		
		
		Intent intent = getIntent();
		if(Intent.ACTION_SEARCH.equals(intent.getAction())){
			String query = intent.getStringExtra(SearchManager.QUERY);
			doMySearch(query);
		}
		
		list = new ArrayList<HashMap<String,String>>();
		
	}
	
	

	@Override
	protected void onNewIntent(Intent intent) {
		Log.v(TAG,"new Intent "+intent.toString());
		Toast.makeText(this, "new Search Intent", Toast.LENGTH_LONG);
		//TODO:search database and show result;
	}



	private void doMySearch(String query) {
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		return true;
	}

}
